home *** CD-ROM | disk | FTP | other *** search
/ 100 Plus Great Games 2 / 100PLUSV2.BIN / games / TowerHanoy.dxr / 00048_knight 2.ls < prev    next >
Encoding:
Text File  |  2002-01-25  |  596 b   |  26 lines

  1. property pKnight, spriteNum, pOriginalLoc, pDirection
  2.  
  3. on beginSprite me
  4.   pKnight = sprite(spriteNum)
  5.   pKnight.flipH = 1
  6.   pOriginalLoc = pKnight.loc
  7. end
  8.  
  9. on enterFrame me
  10.   if pKnight.flipH then
  11.     if pKnight.loc[1] > (((the stage).rect.width / 2) + (pKnight.width / 2)) then
  12.       pKnight.locH = pKnight.loc[1] - 1
  13.     else
  14.       pKnight.flipH = not pKnight.flipH
  15.     end if
  16.   else
  17.     if not pKnight.flipH then
  18.       if pKnight.loc[1] < pOriginalLoc[1] then
  19.         pKnight.locH = pKnight.loc[1] + 1
  20.       else
  21.         pKnight.flipH = not pKnight.flipH
  22.       end if
  23.     end if
  24.   end if
  25. end
  26.